-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save/load nmethod without going through CodeBuffer #27
Conversation
👋 Welcome back asmehra! A progress list of the required criteria for merging this PR into |
@ashu-mehra This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 2 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
Hi @ashu-mehra I see that you use |
I may know answer myself. It is virtual table pointer since Lets go with your SCnmethod for now. |
That's right. My next step is to try store nmethods as is and map them back which would require handling of vtable ptr. CDS already has capability to do that. So it should be feasible. |
@ashu-mehra this pull request can not be integrated into git checkout nmethod-single-copy-load
git fetch https://git.openjdk.org/leyden.git premain
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge premain"
git push |
@ashu-mehra This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
cache Signed-off-by: Ashutosh Mehra <[email protected]>
acfe58c
to
04b77ea
Compare
Webrevs
|
Signed-off-by: Ashutosh Mehra <[email protected]>
I have updated this PR to remove
For quarkus:
This shows an improvement of 2.5~3%.
Springboot with this change:
Quarkus without this change:
Quarkus with this change:
|
Nice. @ashu-mehra do you know why "New CDS + AOT" results for SpringBoot is worse than before: geo mean 532.28 vs 512.17? |
I noticed this but at the moment I don't know the reason for this increase in startup time. |
@vnkozlov I used the first prototype but I am not getting same numbers as mentioned in #27 (comment) |
@ashu-mehra how complex to do the same for adapters? |
I would say it should be easier compared to nmethods. I actually did the first prototype for adapters before trying out nmethods, but it was not storing adapter blobs in the aot code cache. I can resurrect that old patch for adapters and update it to store adapter blobs, as we are doing now for nmethods. |
bool write_oop_map_set(nmethod* nm); | ||
bool write_nmethod_reloc_immediates(GrowableArray<oop>& oop_list, GrowableArray<Metadata*>& metadata_list); | ||
bool write_nmethod_extra_relocations(nmethod* nm, GrowableArray<oop>& oop_list, GrowableArray<Metadata*>& metadata_list); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
write_nmethod_extra_relocations
name doesn't really say what the extra relocs are for i.e. to ensure that at load time we correctly relocate a reference into the current runtime. Could we rename this to write_nmethod_loadtime_relocations
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok to me.
Thank you, @ashu-mehra |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good.
src/hotspot/share/code/nmethod.cpp
Outdated
SCCEntry* scc_entry = scc_reader->scc_entry(); | ||
const char* reloc_addr = scc_reader->addr_of_entry_offset(scnm->relocation_data_offset()); | ||
SCCache::copy_bytes(reloc_addr, (address)relocation_begin(), scnm->relocation_size()); | ||
const char* content_addr = scc_reader->addr_of_entry_offset(scnm->content_offset()); | ||
SCCache::copy_bytes(content_addr, content_begin(), scnm->content_size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why copy them separately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean they usually collocated.
src/hotspot/share/code/SCCache.cpp
Outdated
uint buffer_offset = entry_position + scnm->oop_metadata_offset(); | ||
set_read_position(buffer_offset); | ||
if (!read_oop_metadata_list(target, oop_list, metadata_list, oop_recorder)) { | ||
return false; | ||
} | ||
|
||
buffer_offset = entry_position + scnm->reloc_immediates_offset(); | ||
set_read_position(buffer_offset); | ||
if (!read_oop_metadata_list(target, reloc_immediate_oop_list, reloc_immediate_metadata_list, nullptr)) { | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why you need to create these intermediate arrays for oops and metadata? Can you cache oop_recorder
data as we did before? Or I missing something here.
Github somehow messed up the order of comments. Ignore my [Outdated] code comments - they we from Draft review. |
|
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
Signed-off-by: Ashutosh Mehra <[email protected]>
…cations Signed-off-by: Ashutosh Mehra <[email protected]>
Thanks @adinn for finding out the missing code to flush icache. I have updated the patch to flush the icache and that fixes the intermittent crashes seen on aarch64. I think this patch is now ready to be pushed to premain branch. |
ARM32 build is failing, I think because base for this PR misses adb8107 -- pull it in to get clean GHA run :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
I got some numbers for aarch64 as well and they are in similar range as for x86-64 On a 128 cpu server:
On same 128 cpu server but bound to 0-7 cpus:
Load time as reported by
Load time as reported by
|
/integrate |
Going to push as commit b55a514.
Your commit was automatically rebased without conflicts. |
@ashu-mehra Pushed as commit b55a514. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This is the prototype for storing and loading nmethods without going through the CodeBuffer.
The new implementation is protected by the flag -XX:+UseNewCode2.
Some numbers using this implementation:
spring-boot-getting-started [0] shows startup improvement of ~ 7.5%% and quarkus-getting-started [1] shows improvement of around ~3.5%.
Numbers for Springboot
Numbers for Quarkus:
-Xlog:init logs the load time from AOT code cache at JVM exit.
For spring-boot-getting-started without
UseNewCode2
:For spring-boot-getting-started with
UseNewCode2
:For quarkus-getting-started without
UseNewCode2
For quarkus-getting-started with
UseNewCode2
[0] https://github.com/openjdk/leyden/tree/premain/test/hotspot/jtreg/premain/spring-boot-getting-started
[1] https://github.com/openjdk/leyden/tree/premain/test/hotspot/jtreg/premain/quarkus-getting-started
Progress
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/leyden.git pull/27/head:pull/27
$ git checkout pull/27
Update a local copy of the PR:
$ git checkout pull/27
$ git pull https://git.openjdk.org/leyden.git pull/27/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 27
View PR using the GUI difftool:
$ git pr show -t 27
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/leyden/pull/27.diff
Using Webrev
Link to Webrev Comment